import { createRouter, createWebHistory } from 'vue-router';

import Login from "../components/Login.vue";
import Home from "../components/Home.vue";
import Home2 from "../components/Home2.vue";
import Home3 from "../components/Home3.vue";
import Main from "../components/Main.vue";
import Main2 from "../components/Main2.vue";
import Main3 from "../components/Main3.vue";
import person from "../components/person.vue";
import employeeechart from "../components/employeeechart.vue";
import user from "../components/user.vue";
import category from "../components/Category.vue";
import goods from "../components/goods.vue";
import warehouse from "../components/warehouse.vue";
import announcement from "../components/announcement.vue";
import record from "../components/record.vue";
import goodsechart from "../components/goodsechart.vue";
import goods2 from "../components/goods2.vue";
import person2 from "../components/person2.vue";
import warehouse2 from "../components/warehouse2.vue";
import announcement2 from "../components/announcement2.vue";
import record2 from "../components/record2.vue";
import employee from "../components/employee.vue";
import category2 from "../components/Category2.vue";
import person3 from "../components/person3.vue";
import goods3 from "../components/goods3.vue";
import user2 from "../components/user2.vue"; // 登录页面

const routes = [
    { path: '/', redirect: '/login' }, // 访问根路径重定向到登录页面
    { path: '/login', name: 'Login', component: Login }, // 登录页面
    {
        path:'/admin/Main',
        component: Main,
        redirect: '/admin/Main/adminhome',
        children:[
            {path:'adminhome', name:'AdminHome', component:Home},
            {path:'admin', name:'Admin', component: person},
            {path:'employee', name:'Employee', component: employee},
            {path: 'employeeechart', name:'EmployeeEchart', component: employeeechart},
            {path: 'user', name:'User',component: user},
            {path: 'category', name:'Category', component: category},
            {path: 'goods', name: 'Goods',component: goods},
            {path: 'warehouse', name: 'Warehouse', component: warehouse},
            {path: 'announcement', name: 'Announcement', component: announcement},
            {path: 'record', name: 'Record', component: record},
            {path: 'goodsechart', name: 'GoodsEchart', component: goodsechart}
        ]
    },
    {
        path:'/employee/Main2',
        component: Main2,
        redirect: '/employee/Main2/employeehome',
        children:[
            {path:'employeehome', name:'EmployeeHome', component:Home2},
            {path:'employee', name:'Employee2', component: person2},
            {path: 'category2', name:'Category2', component: category2},
            {path:'goods2', name: 'Goods2', component: goods2},
            {path: 'goodsechart2', name: 'GoodsEcharts2', component: goodsechart},
            {path: 'user', name:'User3',component: user2},
            {path: 'warehouse2', name: 'Warehouse2', component: warehouse2},
            {path: 'announcement2', name: 'Announcement2', component: announcement2},
            {path: 'record2', name: 'Record2', component: record2}
        ]
    },
    {
        path:'/user/Main3',
        component: Main3,
        redirect: '/user/Main3/userhome',
        children:[
            {path:'userhome', name:'UserHome', component:Home3},
            {path: 'user', name: 'User2', component: person3},
            {path: 'category2', name:'Category3', component: category2},
            {path:'goods3', name: 'Goods3', component: goods3},
            {path: 'goodsechart3', name: 'GoodsEcharts3', component: goodsechart},
            {path: 'warehouse2', name: 'Warehouse3', component: warehouse2},
            {path: 'announcement2', name: 'Announcement3', component: announcement2},
            {path: 'record2', name: 'Record3', component: record2}
        ]
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;
